package org.dl.gjz.menyj.task.listener;

import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.ExecutionListener;
import org.springframework.stereotype.Service;

@Service("checkHomeAddress")
public class CheckHomeAddressEndListener implements ExecutionListener {
    private String default_address = "用户注册默认地址";

    @Override
    public void notify(DelegateExecution execution) throws Exception {
        System.out.println("检查用户地址");
        Object homeAddress = execution.getVariable("homeAddress");
        if (homeAddress == null) {
            System.out.println("用户没有填写地址，使用默认地址");
            execution.setVariable("homeAddress", default_address);
        }
    }
}
